var home = new Vue({
    el:'#app',
    data () {
        return{
            isShow1: false,
            isShow2: false,
            isShow3: false,
            isShow4: false,
            isShow5: false,
            isShow6: false,
            isShow7: false,
            num: 0,
            picArr: ["../picture/home5.png","http://www.lzfxkj.com/templets/1/webSite_20200708//images/3banner.jpg","http://www.lzfxkj.com/templets/1/webSite_20200708//images/1banner.jpg"]
        }
    },
    methods:{
        btnLeft () {
            if(this.num == 0) {
                this.num = this.picArr.length - 1
            }
            else{
                 this.num--
            }
        },
        btnRit () {
            if(this.num == this.picArr.length - 1) {
                this.num = 0
            }
            else{
                this.num++
            }
        },
        windowScroll () {
            var ks_area = $(window).height()
            var scrollHeight = $(window).scrollTop()
            var img1top = $("#business_logo1").offset().top
            var img2top = $("#business_logo2").offset().top
            var img3top = $("#business_logo3").offset().top
            var img4top = $("#business_logo4").offset().top
            var img5top = $("#business_logo5").offset().top
            var img6top = $("#business_logo6").offset().top
            var img7top = $("#photo").offset().top
            if(ks_area + scrollHeight >= img1top){
                this.isShow1 = true
            }
            if(ks_area + scrollHeight >= img2top){
                this.isShow2 = true
            }
            if(ks_area + scrollHeight >= img3top){
                this.isShow3 = true
            }
            if(ks_area + scrollHeight >= img4top + 100)
            {
                this.isShow4 = true
            }
            if(ks_area + scrollHeight >= img5top + 100){
                this.isShow5 = true
            }
            if(ks_area + scrollHeight >= img6top + 100){
                this.isShow6 = true
            }
            if(ks_area + scrollHeight >= img7top +100){
                this.isShow7 = true
            }
            },
        destroyed () {
            window.removeEventListener('scroll', this.windowScroll); //销毁滚动事件
        }
        },
        mounted(){
            // window.onbeforeunload = function(){
            //     document.documentElement.scrollTop = 0;  //ie下
            //     document.body.scrollTop = 0;  //非ie
            // }
            this.windowScroll ()
            $(window).scroll(this.windowScroll)
            setInterval(this.btnRit, 5000);
        }
})